home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 3.1 / toasterall / arexx_examples / gpigrabber.rexx < prev    next >
OS/2 REXX Batch file  |  1993-06-06  |  3KB  |  73 lines

  1. /* StopFrame.rexx  Grabs frames on cue from GPI trigger for stop-action animation */
  2. /* By Arnie Cachelin © 1992 NewTek Inc. */
  3.  
  4. /*
  5.     This program will grab and save frames on cue from the GPI trigger.
  6.     If you enter a number to grab, it will save that many then exit.
  7.     Otherwise, 3 frames will be saved, then the prog. will exit.  Since
  8.     the Toaster is waiting for GPI input most of the time, it will not
  9.     respond  to anything else, which you may find annoying.  You can easily
  10.     give  your Toaster GPI pulses by attaching a spare mouse or joystick to
  11.     the second mouse port then clicking the button.  You can also find long
  12.     joystick extender cables at places like Radio Shack.
  13.  
  14.     To grab frames for a claymation of stop-action style animation, setup your
  15.     camera and 'actors', hook up a GPI trigger, and start this script with
  16.     appropriate arguments.  When your first frame is ready, hit the trigger
  17.     to grab and save it.  The toaster will then go into an 'onionskin' mode
  18.     where the camera is half dissolved over the last frame for ease of
  19.     positioning the actors.  When you hit the GPI again, the Toaster will leave
  20.     onionskin mode and get ready to grab the next frame at the next GPI signal.
  21.  
  22.     For best results, watch out for stray shadows, or shadows from the sun which
  23.     will change over the course of your shoot
  24. */
  25.  
  26. OPTIONS RESULTS
  27. parse arg count name
  28.  if count="" then count=3
  29. TOASTERLIB="ToasterARexx.port"
  30.  
  31. IF POS(TOASTERLIB , SHOW('Libraries')) = 0 THEN
  32.   IF ~ADDLIB(TOASTERLIB , 0) THEN say "Please start your Toaster"
  33.  
  34. say "Saving "count" frames as "name
  35. Switcher(TOSW)        /* Go to Switcher screen */
  36. Switcher(P001)
  37. Switcher(LVID)
  38. Switcher(PDV1)
  39. Switcher(P001)
  40. Switcher(SGPI,POS)    /* Set GPI trigger to positive (leading edge of pulse) */
  41. Do i=0 to count-1
  42.   Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in */
  43.   Switcher(FVID)        /* Freeze frame */
  44.   Frame=right(trim(i),3,"0")
  45.   if name="" then c=SaveNextFrame("grab")
  46.   else do
  47.     say name||right(i,3,'0')
  48.     t=Switcher(SRGB,"ram:shit",0,0)
  49.     end
  50.   Switcher(P001)
  51.   Switcher(MDV1)
  52.   Switcher(TBAR,255)
  53.   Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in */
  54. /*  address command 'wait 10 secs' */
  55.   Switcher(AUTO)
  56.   Switcher(P001)
  57.   Switcher(LVID)        /* Set to live digital video */
  58. end
  59. Switcher(TOWB)        /* Go to Workbench screen */
  60.  
  61. exit
  62.  
  63. SaveNextFrame:  Procedure
  64.   arg name
  65.   N=Switcher(STAT,KNUM)       /* Get the current keypad number */
  66.   fs=N+1
  67.   do while Switcher(FMXI,fs) & fs~=N  /* Is the frame already there? */
  68.     if fs=999 then fs=0       /* wrap around at last frame */
  69.     else fs=fs+1
  70.   end
  71.   if fs=N then t=10        /* got to starting frame without finding open fs */
  72.   else t=Switcher(FMSV,fs,name)    /* Save frame */
  73.   return t